<template>
    <!-- 面板头部 -->
    <panelHead :route="route" />
    <el-row>
        <el-col class="col" :span="12">
            <div class="col-content" style="margin-right: 20px;">
                <div class="text1">
                    <el-image class="img" :src="user.user_img" />
                    <span>{{ user.user_name }}</span>
                </div>
                <div class="text2">
                    <div style="margin-bottom: 5px;">当前权限：{{ user.permission }}</div>
                    <div>登录的ip：{{ user.ip }}</div>
                </div>
            </div>
        </el-col>
        <el-col class="col" :span="12">
            <div class="col-content">
                <div class="content-item">
                    <div class="col-content-item" v-for="(item, index) in types" :key="index">
                        <el-image class="img" :src="img[item.state]" />
                        <div class="text-item" style="margin-left: 20px;">
                            <div class="text-item1">{{ item.num }}</div>
                            <div class="text-item2">{{ item.state }}</div>
                        </div>
                    </div>
                </div>
            </div>
        </el-col>
    </el-row>
    <el-row>
        <el-col :span="12"></el-col>
    </el-row>
</template>

<script setup name="Dashboard">
import { onMounted, reactive } from 'vue'
import { useRoute } from 'vue-router'
import { report } from '../../api'
const route = useRoute()

const typeList = reactive([])
const types = reactive([])
const user = reactive({})
const img = reactive({
    '待支付': '../../../public/assets/dzf.png',
    '待服务': '../../../public/assets/dfw.png',
    '已完成': '../../../public/assets/ywc.png',
    '已取消': '../../../public/assets/yqx.png',
})

onMounted(() => {
    getReportData()
})
const getReportData = () => {
    report().then(({ data }) => {
        Object.assign(typeList, data.data.typeList)
        Object.assign(types, data.data.types)
        Object.assign(user, data.data.user)
    })
}
</script>

<style lang="less" scoped>
.col {

    .col-content {
        background-color: #fff;
        box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
        line-height: 50px;
        margin: 10px 0;
        height: 90%;

        .content-item {
            display: flex;
            flex-wrap: wrap;

            .col-content-item {
                padding: 35px;
                display: flex;
                align-items: center;
                width: calc(50%);
                box-sizing: border-box;

                .text-item1 {
                    font-size: 16px;
                    line-height: 20px;
                }

                .text-item2 {
                    font-size: 12px;
                    line-height: 20px;
                    color: #666666;
                }

            }
        }
    }

    .text1 {
        font-size: 18px;
        line-height: 25px;
        font-weight: bold;
        border-bottom: 0.5px solid #f5f5f5;
        display: flex;
        align-items: center;

        .img {
            width: 150px;
            height: 150px;
            padding: 10px;
        }
    }

    .text2 {
        padding: 20px;
        font-size: 14px;
        line-height: 20px;
        color: #666666;
    }
}
</style>